/* eslint-disable semi */
/* eslint-disable semi */
/* eslint-disable quotes */
<template>
    <van-pull-refresh v-model="isLoading">

        <div class="TopList">

            <router-link to="/HamDivision">
                <van-icon class="Backlink"
                          name="arrow-left" />
            </router-link>

            <span> 我的订单 </span>

        </div>

        <div class="outline"></div>

        <!-- 我的订单 -->
        <van-tabs color=#37CD87
                  title-active-color=#37CD87>
            <van-tab title="全部">
                <div class="hello-4"
                     v-for="(itemlist, index) in Piglist"
                     :key="index">
                    <div class="hello-4-11">
                        <div class="hello-4-11-number">订单编号:{{itemlist.Ordernum}} </div>
                        <div class="hello-4-11-state"
                             :class="[itemlist.Pay !='已结算' ? '':'addcolor']">{{itemlist.Pay}}</div>
                    </div>
                    <div class="hello-4-top">
                        <div class="hello-4-top-left">
                            <img :src="itemlist.imgSrc"
                                 alt />
                        </div>
                        <div class="hello-4-top-right">
                            <p class="pig">{{itemlist.Pig}}</p>
                            <div class="secend">
                                <van-tag class="date">{{itemlist.Date}}</van-tag>
                                <van-tag class="recive"
                                         color="#FFBA68"
                                         v-if="itemlist.bonus_type==1">{{itemlist.Way}}
                                </van-tag>
                                <van-tag class="recive"
                                         color="#FFBA68"
                                         v-else-if="itemlist.bonus_type==2">产品</van-tag>
                                <van-tag class="recive"
                                         color="#Ffffff"
                                         v-else>{{itemlist.Way}}</van-tag>
                            </div>
                            <p class="every-pig">¥5000.00/头</p>
                            <div class="pig-number">X1</div>
                        </div>

                    </div>
                    <div class="hello-4-11">
                        <div class="hello-4-11-number  aadcolor">合计:¥5000.00 </div>
                        <div class="hello-4-11-state-1"
                             :class="[itemlist.id !=0? '':'addblock']">
                            <van-button size="small"
                                        type="primary"
                                        @click="topurchase()">查看合同</van-button>
                        </div>
                        <div class="hello-4-11-state-2">
                            <van-button size="small"
                                        type="danger"
                                        @click="tosettlement()">查看详情</van-button>
                        </div>
                    </div>
                </div>

                <div class="hello-1"
                     v-for="(item, index) in middleimages"
                     :key="index"
                     :class="[Piglist.length ==0 ? '':'Add-a-hidden']">
                    <van-image class="hello-1-img"
                               width="3.2rem"
                               height="1.893rem"
                               :src="item.imgSrc" />
                    <p>暂无产品订单</p>
                </div>

            </van-tab>

            <!-- 判断
 1、没有订单 判断为空list长度即可
 2、没有待付款状态订单，遍历数组
 3、有该状态订单，不显示无产品图片-->
            <van-tab title="待付款">
                <div v-for="(itemlist, index) in Piglist"
                     :key="index">
                    <div class="hello-4"
                         v-if="itemlist.Pay =='待付款'">

                        <div class="hello-4-11">
                            <div class="hello-4-11-number">订单编号:{{itemlist.Ordernum}} </div>
                            <div class="hello-4-11-state">{{itemlist.Pay}}</div>
                        </div>
                        <div class="hello-4-top">
                            <div class="hello-4-top-left">
                                <img :src="itemlist.imgSrc"
                                     alt />
                            </div>
                            <div class="hello-4-top-right">
                                <p class="pig">{{itemlist.Pig}}</p>
                                <div class="secend">
                                    <van-tag class="date">{{itemlist.Date}}</van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-if="itemlist.bonus_type==1">{{itemlist.Way}}
                                    </van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-else-if="itemlist.bonus_type==2">产品</van-tag>
                                    <van-tag class="recive"
                                             color="#Ffffff"
                                             v-else>{{itemlist.Way}}</van-tag>
                                </div>
                                <p class="every-pig">¥5000.00/头</p>
                                <div class="pig-number">X1</div>
                            </div>

                        </div>
                        <div class="hello-4-11">
                            <div class="hello-4-11-number  aadcolor">合计:¥5000.00 </div>
                            <div class="hello-4-11-state-1"
                                 :class="[itemlist.id !=0? '':'addblock']">
                                <van-button size="small"
                                            type="primary"
                                            @click="topurchase()">查看合同</van-button>
                            </div>
                            <div class="hello-4-11-state-2">
                                <van-button size="small"
                                            type="danger"
                                            @click="tosettlement()">查看详情</van-button>
                            </div>
                        </div>

                    </div>

                </div>

                <div class="hello-1"
                     v-for="(item, index) in middleimages"
                     :key="index"
                     :class="[Piglist.length ==0 ? '':'Add-a-hidden']">
                    <van-image class="hello-1-img"
                               width="3.2rem"
                               height="1.893rem"
                               :src="item.imgSrc" />
                    <p>暂无产品订单</p>
                </div>

            </van-tab>

            <van-tab title="结算中">
                <div v-for="(itemlist, index) in Piglist"
                     :key="index">

                    <div class="hello-4"
                         v-if="itemlist.Pay =='结算中'">

                        <div class="hello-4-11">
                            <div class="hello-4-11-number">订单编号:{{itemlist.Ordernum}} </div>
                            <div class="hello-4-11-state">{{itemlist.Pay}}</div>
                        </div>
                        <div class="hello-4-top">
                            <div class="hello-4-top-left">
                                <img :src="itemlist.imgSrc"
                                     alt />
                            </div>
                            <div class="hello-4-top-right">
                                <p class="pig">{{itemlist.Pig}}</p>
                                <div class="secend">
                                    <van-tag class="date">{{itemlist.Date}}</van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-if="itemlist.bonus_type==1">{{itemlist.Way}}
                                    </van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-else-if="itemlist.bonus_type==2">产品</van-tag>
                                    <van-tag class="recive"
                                             color="#Ffffff"
                                             v-else>{{itemlist.Way}}</van-tag>
                                </div>
                                <p class="every-pig">¥5000.00/头</p>
                                <div class="pig-number">X1</div>
                            </div>

                        </div>
                        <div class="hello-4-11">
                            <div class="hello-4-11-number  aadcolor">合计:¥5000.00 </div>
                            <div class="hello-4-11-state-1"
                                 :class="[itemlist.id !=0? '':'addblock']">
                                <van-button size="small"
                                            type="primary"
                                            @click="topurchase()">查看合同</van-button>
                            </div>
                            <div class="hello-4-11-state-2">
                                <van-button size="small"
                                            type="danger"
                                            @click="tosettlement()">查看详情</van-button>
                            </div>
                        </div>

                    </div>

                </div>

                <div class="hello-1"
                     v-for="(item, index) in middleimages"
                     :key="index"
                     :class="[Piglist.length ==0 ? '':'Add-a-hidden']">
                    <van-image class="hello-1-img"
                               width="3.2rem"
                               height="1.893rem"
                               :src="item.imgSrc" />
                    <p>暂无产品订单</p>
                </div>
            </van-tab>

            <van-tab title="已结算">

                <div v-for="(itemlist, index) in Piglist"
                     :key="index">

                    <div class="hello-4"
                         v-if="itemlist.Pay =='已结算'">

                        <div class="hello-4-11">
                            <div class="hello-4-11-number">订单编号:{{itemlist.Ordernum}} </div>
                            <div class="hello-4-11-state-over">{{itemlist.Pay}}</div>
                        </div>
                        <div class="hello-4-top">
                            <div class="hello-4-top-left">
                                <img :src="itemlist.imgSrc"
                                     alt />
                            </div>
                            <div class="hello-4-top-right">
                                <p class="pig">{{itemlist.Pig}}</p>
                                <div class="secend">
                                    <van-tag class="date">{{itemlist.Date}}</van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-if="itemlist.bonus_type==1">{{itemlist.Way}}
                                    </van-tag>
                                    <van-tag class="recive"
                                             color="#FFBA68"
                                             v-else-if="itemlist.bonus_type==2">产品</van-tag>
                                    <van-tag class="recive"
                                             color="#Ffffff"
                                             v-else>{{itemlist.Way}}</van-tag>
                                </div>
                                <p class="every-pig">¥5000.00/头</p>
                                <div class="pig-number">X1</div>
                            </div>

                        </div>
                        <div class="hello-4-11">
                            <div class="hello-4-11-number  aadcolor">合计:¥5000.00 </div>
                            <div class="hello-4-11-state-1"
                                 :class="[itemlist.id !=0? '':'addblock']">
                                <van-button size="small"
                                            type="primary"
                                            @click="topurchase()">查看合同</van-button>
                            </div>
                            <div class="hello-4-11-state-2">
                                <van-button size="small"
                                            type="danger"
                                            @click="tosettlement()">查看详情</van-button>
                            </div>
                        </div>

                    </div>

                    <!-- <div :class="[itemlist.Pay =='已结算' ? 'Add-a-hidden':'']" v-else>
            <div class="hello-1" v-for="(item, index) in middleimages" :key="index">
              <van-image class="hello-1-img" width="120px" height="71px" :src="item.imgSrc" />
              <p>暂无产品订单</p>
            </div>
          </div> -->
                </div>

                <div class="hello-1"
                     v-for="(item, index) in middleimages"
                     :key="index"
                     :class="[Piglist.length ==0 ? '':'Add-a-hidden']">
                    <van-image class="hello-1-img"
                               width="3.2rem"
                               height="1.893rem"
                               :src="item.imgSrc" />
                    <p>暂无产品订单</p>
                </div>
            </van-tab>
        </van-tabs>

    </van-pull-refresh>
</template>

<script>
import TabBar from "./TabBar.vue";
export default {
    components: {
        TabBar
    },
    // eslint-disable-next-line space-before-function-paren
    data() {
        return {
            count: 0,
            is_show: false,
            isLoading: false,
            Loading: false,
            index: 0,
            bannerimages: [
                { id: 0, imgSrc: require("../assets/images/a16.jpg") }
                // { id: 1, imgSrc: require("../assets/images/a18.jpg") }
            ],
            detailsimages: [
                { id: 0, imgSrc: require("../assets/images/detailsimg1.jpg") },
                { id: 1, imgSrc: require("../assets/images/detailsimg2.jpg") }
            ],

            middleimages: [{ id: 0, imgSrc: require("../assets/images/none.png") }],
            Piglist: [
                {
                    id: 0,
                    Ordernum: "2019121615435732183515424991",
                    Pay: "待付款",
                    Pig: "乌金猪",
                    Date: "第1期",
                    Way: "微信",
                    Money: "5000.00",
                    Month: "8",
                    imgSrc: require("../assets/images/a11.jpg")
                },
                {
                    id: 1,
                    Ordernum: "20191216154357321835154249912",
                    Pay: "结算中",
                    Pig: "乌金猪",
                    Date: "第1期",
                    Way: "现金",
                    Money: "5000.00",
                    Month: "8",
                    imgSrc: require("../assets/images/a11.jpg")
                },
                {
                    id: 2,
                    Ordernum: "20191216154357321835154249912",
                    Pay: "已结算",
                    Pig: "乌金猪",
                    Date: "第2期",
                    Way: "线上",
                    Money: "5000.00",
                    Month: "12",
                    imgSrc: require("../assets/images/a11.jpg")
                }
            ],

            loading: false,
            finished: false,
            num: 0,
            Orangetrees: []
        };
    },

    mounted() {
        // 上拉加载
    },
    // eslint-disable-next-line space-before-function-paren
    // created:vue生命周期中的钩子函数，在这个时间点，data中的数据已经注入到响应式系统中
    created() { },

    methods: {
        topurchase() {
            this.$router.push({ path: "/Purchase" });
        },
        tosettlement() {
            this.$router.push({ path: "/Settlement" });
        },

        //vant 加载列表方法
        onLoad() {
            // 异步更新数据
            setTimeout(() => {
                for (let i = 0; i < 1; i++) {
                    // this.Piglist.push(this.Piglist.length + 1);
                }
                // 加载状态结束
                this.loading = false;

                // 数据全部加载完成
                if (this.Piglist.length > 0) {
                    this.finished = true;
                }
            }, 500);
        }
    }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
/* //自定义.css的样式路径 */
/* @import "../css/HomePage.css"; */

* {
    padding: 0;
    margin: 0;
}
body {
    background-color: #f6f6f6;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    margin: 0;
    display: block;
}
div {
    display: block;
    box-sizing: border-box;
}

.TopList {
    width: 100%;
    height: 45px;
    font-size: 16px;
    text-align: left;
    background: #ffffff;
}
.Backlink {
    line-height: 50px;
    margin-left: 10px;
}
.TopList span {
    line-height: 25px;
    margin-left: 110px;
    width: 60%;
}

.van-swipe {
    width: 100%;
    height: 100%;
}

.hello-3 {
    width: 100%;
    height: 200.34px;
    padding: 0 3%;
    padding-top: 10%;
    padding-left: 35%;
    background: #ffffff;
    text-align: left;
}

.hello-3 p {
    margin-top: 10px;
    margin-left: -10px;
    font-size: 16px;
    color: #bbb;
}
.recive {
    width: 30px;
    height: 20px;
    text-align: center;
    padding-left: 5px;
    margin-right: 10px;
    color: rgb(233, 92, 111);
    border: 1px solid rgb(233, 92, 111);
    background-color: #fff;
}

.lastadd {
    position: fixed;
    bottom: 0px;
    background: #37cd87;
    width: 100%;
    height: 50px;
    color: #fff;
    line-height: 50px;
    font-size: 18px;
}

.gray {
    color: gray;
    opacity: 0.5;
}
.onlygray {
    color: gray;
}
.close {
    display: none;
}

li {
    position: absolute;
}

.active {
    background: #bfd6b6 !important;
}

.pig {
    width: 100%;
    font-size: 16px;
    color: #333;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.secend {
    display: flex;
    padding-top: 10px;
}
.date {
    width: 36.69px;
    height: 20px;
    text-align: center;
    padding-left: 5px;
    background-color: #f5a7a7;
    color: #fff;
    margin-right: 10px;
}
.recive {
    width: 30px;
    height: 20px;
    text-align: center;
    padding-left: 5px;
    margin-right: 10px;
    color: rgb(233, 92, 111);
    background-color: #fff;
}

.hello-4-bottom {
    width: 100%;
    padding: 3%;
}

.color-2 {
    color: #8a8a8a;
    font-size: 14px;
}
.adddistance {
    text-align: center;
    width: 100%;
}

.length {
    width: 100%;
    height: 40px;
    padding-top: 20px;
}

h4 {
    color: #e95c6f;
    font-size: 20px;
    margin-bottom: 5px;
    clear: both;
    width: 100%;
    display: block;
    font-weight: bold;
}

.num-List {
    width: 100px;
    height: 32px;
    line-height: 24px;
    border: 1px solid #f6f6f6;
    padding: 4px 7px;
    font-size: 12px;
    color: #333;
    border-radius: 5px;
    margin-right: 8px;
    margin-bottom: 8px;
    -webkit-box-flex: 0;
    -webkit-flex: none;
    flex: none;
}

.hello-1 {
    width: 100%;
    height: 600px;
    background: #f6f6f6;
}
.hello-1 p {
    margin-top: 18px;
    font-size: 15px;
    color: #bbb;
}
.hello-1-img {
    margin-top: 35px;
    margin-left: 148px;
    border-radius: 10px;
    pointer-events: none;
}
.hello-1-details {
    width: 100%;
    height: auto;
}
.hello-1-details-img {
    border-radius: 10px;
    pointer-events: none;
}
.filler {
    width: 100%;
    height: 50px;
}
.record-list {
    width: 100%;
    height: 88px;
    padding: 0 3%;
    display: flex;
    background: #ffffff;
    padding-top: 20px;
    border-bottom: 1px solid #f6f6f6;
}
.record-list-left {
    width: 323px;
    height: 100%;
    display: flex;
}

.record-list-right {
    width: 66px;
    height: 66px;
    display: flex;
    width: 60px;
    text-align: center;
    height: 60px;
    line-height: 60px;
    font-size: 18px;
}
.all-list-left {
    width: 123px;
    height: 50px;
    text-align: left;
}
.name-h5 {
    width: 123px;
    color: #555;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}
.time-p {
    width: 123px;
    color: #999;
    font-size: 12px;
}

.current-list {
    width: 100%;
    height: 88px;
    padding: 0 3%;
    display: flex;
    background: #ffffff;
    padding-top: 20px;
    border-bottom: 1px solid #f6f6f6;
}
.current-list-left {
    width: 323px;
    height: 100%;
    display: flex;
}

.current-list-right {
    width: 66px;
    height: 66px;
    display: flex;
    width: 60px;
    text-align: center;
    height: 60px;
    line-height: 60px;
    font-size: 18px;
}
.current-list-number {
    height: 22px;
    width: 44px;
    font-size: 018px;
    padding-top: 20px;
    text-align: left;
    color: #333;
    flex: none;
    font-style: oblique;
}

.outline {
    width: 100;
    height: 1px;
    background: #f6f6f6;
}

.hello-1 {
    width: 100%;
    height: 600px;
    background: #f6f6f6;
}
.hello-1 p {
    margin-top: 25px;
    color: #bbb;
    font-size: 14px;
    font-weight: 350;
}
.hello-1-img {
    margin-top: 35px;
    margin-left: 131px;

    border-radius: 10px;
    pointer-events: none;
}

.hello-4 {
    height: 181.25px;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    margin-bottom: 10px;
}

.hello-4-11 {
    width: 100%;
    height: 30px;
    display: flex;
    line-height: 30px;
}
.hello-4-11-number {
    padding-left: 15px;
    font-size: 14px;
}
.hello-4-11-state {
    font-size: 14px;
    padding-left: 25px;
    color: #e95c6f;
}
.hello-4-11-state-over {
    font-size: 14px;
    padding-left: 25px;
    color: #07c160;
}
.addcolor {
    color: #07c160;
}
.aadcolor {
    margin-top: 10px;
    font-size: 16px;
    color: #e95c6f;
}
.hello-4-11-state-1 {
    font-size: 14px;
    padding-left: 120px;
    padding-top: 10px;
    color: #e95c6f;
}
.hello-4-11-state-2 {
    font-size: 14px;
    padding-left: 10px;
    padding-top: 10px;
    color: #e95c6f;
}

.hello-4-top {
    padding-top: 10px;
    padding-left: 10px;
    width: 100%;
    height: 100px;
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0 3%;
    border-bottom: 1px solid #f6f6f6;
}

.hello-4-top-left {
    width: 78px;
    height: 78px;
}
.hello-4-top-left img {
    width: 78px;
    height: 78px;
}

.hello-4-top-right {
    width: 106.69px;
    height: 80px;
    text-align: left;
    padding-left: 12px;
}

.hello-4-top-last {
    width: 58px;
    height: 58px;
    margin-left: 105px;
}
.hello-4-top-last img {
    width: 58px;
    height: 58px;
}

.pig {
    width: 100%;
    font-size: 16px;
    color: #333;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.every-pig {
    font-size: 16px;
    color: #888;
    text-align: left;
    overflow: hidden;
}
.pig-number {
    width: 30px;
    height: 30px;
    text-align: center;
    font-size: 16px;
    color: #888;
    margin-left: 230px;
    margin-top: -50px;
}

.secend {
    display: flex;
    padding-top: 10px;
}

.date-gray {
    width: 36.69px;
    height: 20px;
    text-align: center;
    padding-left: 5px;
    background-color: rgb(233, 92, 111);
    color: gray;
    margin-right: 10px;
}
.recive {
    width: 30px;
    height: 20px;
    text-align: center;
    padding-left: 5px;
    margin-right: 10px;
    color: rgb(233, 92, 111);
    background-color: #fff;
}

.hello-4-bottom {
    width: 100%;
    padding: 3%;
}
.addblock {
    visibility: hidden;
}
.Add-a-hidden {
    display: none;
}
</style>


